package cn.jobstart.service.impl;

import cn.jobstart.modelExt.ResumeCertificateExt;
import cn.jobstart.vo.ResumeAssociationActivityMiniDomainVO;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import cn.jobstart.modelExt.ResumeAssociationActivityExt;
import cn.jobstart.dao.IResumeAssociationActivityDao;
import cn.jobstart.searchExt.ResumeAssociationActivitySearchExt;
import cn.jobstart.pubInter.IBaseDao;
import cn.jobstart.pubInter.AbstractBaseService;
import cn.jobstart.service.IResumeAssociationActivityService;
import lombok.extern.slf4j.Slf4j;
import cn.jobstart.common.StringUtil;
import cn.jobstart.common.SkList;
import cn.jobstart.pubInter.exception.SkException;

import java.util.List;


/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeAssociationActivityService      在校经历
*/
@Service(value = "resumeAssociationActivityService")
@Slf4j
public class ResumeAssociationActivityServiceImpl extends AbstractBaseService<ResumeAssociationActivityExt, ResumeAssociationActivitySearchExt,String> implements IResumeAssociationActivityService {

    @Resource(name = "resumeAssociationActivityDao")
    private IResumeAssociationActivityDao resumeAssociationActivityDao;

    @Override
    public IBaseDao<ResumeAssociationActivityExt, ResumeAssociationActivitySearchExt,String> getDao() {
        return resumeAssociationActivityDao;
    }


    /**
     * @param resumeId
     * @return
     */
    @Override
    public List<ResumeAssociationActivityExt> getListByResumeId(String resumeId) {
        if(StringUtil.isNullOrEmpty(resumeId)){
            return null;
        }
        try {
            return getAllList(ResumeAssociationActivitySearchExt.getInstance().setResumesIdEq(resumeId));
        } catch (SkException e) {
            return null;
        }
    }

    /**
     * @param resumeId
     * @return
     */
    @Override
    public String getAssociationActivityStrByResumeId(String resumeId) {
        try {
            List<ResumeAssociationActivityExt> list =getListByResumeId(resumeId);


            return StringUtil.getJsonArrayStrByList(list, ResumeAssociationActivityMiniDomainVO.class);



        } catch (Exception e) {

        }
        return "";
    }
}